import { createStore } from 'vuex';
import {SERVER} from "@/configs";

// 创建一个新的 store 实例
export const store = createStore({
  state: {
    username: sessionStorage.getItem("username") || '',
    roomname: sessionStorage.getItem("roomname") || '',
  },
  mutations: {
    setUsername: (state, username: string) => {
      state.username = username;
      console.log(username)
      sessionStorage.setItem("username",username)
    },
    setRoomname: (state, roomname: string) => {
      state.roomname = roomname;
      console.log(roomname)
      sessionStorage.setItem("roomname",roomname)
    },
  }
})
//
// @ts-ignore
